package com.gourd.common.rbac.service.impl;

import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.gourd.common.rbac.dao.RbacPermissionDao;
import com.gourd.common.rbac.entity.RbacPermission;
import com.gourd.common.rbac.service.RbacPermissionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 权限service
 *
 * @author gourd
 * @date 2019-04-02 17:26:16
 * Created by CodeGen .
 */
@Service
@Slf4j
public class RbacPermissionServiceImpl extends ServiceImpl<RbacPermissionDao, RbacPermission> implements RbacPermissionService  {

    @Autowired
    private RbacPermissionDao rbacPermissionMapper;

    @Override
    public List<RbacPermission> findByRoleIds(List<Long> roleIds){
        return  rbacPermissionMapper.findByRoleIds(roleIds);
    }

    /**
     * 删除权限
     * @return
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void delete(Long  id){
        rbacPermissionMapper.deleteById(id);
    }

}
